package com.jyw.web.controller.system;

import com.jyw.common.annotation.Log;
import com.jyw.common.core.domain.CommonResult;
import com.jyw.common.enums.BusinessType;
import com.jyw.system.domain.vo.SysBigScreenConfigVo;
import com.jyw.system.domain.vo.SysServiceAttendanceConfigVo;
import com.jyw.system.service.ISysBigScreenConfigService;
import com.jyw.system.service.ISysServiceAttendanceConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Created by ZhangCheng on 2023/08/15 (系统服务台考勤配置)
 */
@Api(tags = "系统服务台考勤配置")
@RestController
@RequestMapping("/system/serviceAttendanceConfig")
public class SysServiceAttendanceConfigController {

    @Autowired
    private ISysServiceAttendanceConfigService sysServiceAttendanceConfigService;

    /**
     * 获取系统服务台考勤配置
     *
     * @return
     */
    @GetMapping("/getConfig")
    @ApiOperation("获取系统服务台考勤配置")
    public CommonResult<SysServiceAttendanceConfigVo> getConfig() {
        return CommonResult.success(sysServiceAttendanceConfigService.getDefaultConfig());
    }

    /**
     * 修改系统服务台考勤配置
     *
     * @param sysServiceAttendanceConfigVo
     * @return
     */
    @Log(title = "修改系统服务台考勤配置", businessType = BusinessType.UPDATE)
    @PutMapping("/updateConfig")
    @ApiOperation("修改系统服务台考勤配置")
    public CommonResult updateConfig(@RequestBody SysServiceAttendanceConfigVo sysServiceAttendanceConfigVo) {
        sysServiceAttendanceConfigService.updateConfig(sysServiceAttendanceConfigVo);
        return CommonResult.success();
    }
}
